const tabs = {
    namespaced: true,
    state: {
        openTab: [],
        activeIndex: ''
    },
    mutations: {
        add_tabs(state,data) {
            state.openTab.push(data);
        },
        delete_tabs(state,route) {
            let index = 0;
            for(let tab of state.openTab) {
                if(tab.route === route) {
                    break;
                }
                index++;
            }
            state.openTab.splice(index,1)
        },
        set_active_index (state,index) {
            state.activeIndex = index;
        }
    }
}


export default tabs;








